package pers.cj.pdos.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pers.cj.pdos.entity.HouseWaitOut;
import pers.cj.pdos.mapper.HouseWaitOutMapper;
import pers.cj.pdos.service.IHouseWaitOutService;
import pers.cj.pdos.utils.Utils;
import pers.cj.pdos.vo.HouseWaitInVo;
import pers.cj.pdos.vo.HouseWaitOutVo;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenj
 * @since 2020-02-21
 */
@Service
public class HouseWaitOutServiceImpl extends ServiceImpl<HouseWaitOutMapper, HouseWaitOut> implements IHouseWaitOutService {
    @Autowired
    HouseWaitOutMapper houseWaitOutMapper;


    @Override
    public List<HouseWaitOutVo> listVo(String companyId,
                                       Integer page,
                                       Integer limit,
                                       Integer status,
                                       Integer type,
                                       String search,
                                       String no,
                                       String goodsName,
                                       String remark,
                                       String unitName,
                                       Date makeTime1,
                                       Date makeTime2,
                                       String makeUserId,
                                       String userStoreId,
                                       String userId,
                                       Date date1,
                                       Date date2,
                                       String storeId,
                                       String houseId) {
        return houseWaitOutMapper.listVo(companyId,
                Utils.genPage(page,limit),
                limit,
                status,
                type,
                search,
                no,
                goodsName,
                remark,
                unitName,
                makeTime1,
                makeTime2,
                makeUserId,
                userStoreId,
                userId,
                date1,
                date2,
                storeId,
                houseId);
    }

    @Override
    public long count(String companyId,
                      Integer status,
                      Integer type,
                      String search,
                      String no,
                      String goodsName,
                      String remark,
                      String unitName,
                      Date makeTime1,
                      Date makeTime2,
                      String makeUserId,
                      String userStoreId,
                      String userId,
                      Date date1,
                      Date date2,
                      String storeId,
                      String houseId) {
        return houseWaitOutMapper.count(companyId,
                status,
                type,
                search,
                no,
                goodsName,
                remark,
                unitName,
                makeTime1,
                makeTime2,
                makeUserId,
                userStoreId,
                userId,
                date1,
                date2,
                storeId,
                houseId);
    }

    @Override
    public HouseWaitOutVo getVoById(String id) {
        return houseWaitOutMapper.getVoById(id);
    }

    @Override
    public List<HouseWaitOutVo> listVoByIds(List<String> ids) {
        return houseWaitOutMapper.listVoByIds(ids);
    }

    @Override
    public boolean checkWait() {
        return houseWaitOutMapper.checkWait() > 0;
    }
}
